/*
 * SimpleView.java
 *
 * Created on October 9, 2007, 11:08 AM
 *
 */
package org.osdtsystem.dataset;

import org.osdtsystem.hierarchy.HClass;
import org.osdtsystem.hierarchy.Hierarchy;

/**
 * A simple view without subviews.
 * @param <H> the type of hierarchy classes in the view
 * @author Martin Haulrich and Matthias Buch-Kromann
 */
public class SimpleHierarchyView<H extends HClass> extends SimpleView implements HierarchyView<H> {
    Hierarchy<H> hierarchy;

    /**
     * Constructor for simple view.
     * @param hierarchy the hierarchy
     * @param index the index of the feature in the dataset that this view supports
     */
    public SimpleHierarchyView(Hierarchy<H> hierarchy, int index) {
        super(index);
        this.hierarchy = hierarchy;
    }

    @Override
    public <H2 extends HClass> HierarchyView<H2> subview(Class<H2> x, int index) {
        throw new IllegalArgumentException("No subviews associated with simple view " + this);
    }

    @Override
    public Hierarchy<H> hierarchy() {
        return hierarchy;
    }
}
